﻿using Shop.User.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web;

namespace Shop.User
{
    /// <summary>
    /// 用户状态类
    /// </summary>
    public static class UserState
    {
        /// <summary>
        /// 保存用户状态
        /// </summary>
        /// <param name="CurrUser"></param>
        public static void SaveUserState(UsersInfo UInfo)
        {
            HttpContext.Current.Session["LoginUser"] = UInfo;
        }
        /// <summary>
        /// 读取用户信息
        /// </summary>
        /// <returns></returns>
        public static UsersInfo GetUserState()
        {
            UsersInfo CurrUser = (UsersInfo)HttpContext.Current.Session["LoginUser"];
            return CurrUser;
        }
        /// <summary>
        /// 删除用户状态
        /// </summary>
        public static void DelInfo()
        {
            HttpContext.Current.Session["LoginUser"] = null;
        }
    }
}
